<?php
//No direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.view');

class OwnserviceViewPoint extends JView
{
	function display($tpl = null) 
	{
		global $mainframe, $option;

		//Initialise variables
		$document	= & JFactory::getDocument();
		$user		= & JFactory::getUser();
		$ownuser	= & Ownservice::getUser();
		$params 	= & $mainframe->getParams('com_ownservice');
		$pathway  	= & $mainframe->getPathway();
		
		//Set page title information
		$menus		= &JSite::getMenu();
		$menu		= $menus->getActive();
		
		//check permission for manage levels
		if($user->gid < 25) 
		{
			if (!Ownservice::checkAccess( 'point', 'manage' )) {
				JError::raiseWarning(500, JText::_('ALERTNOTAUTH') );
				$mainframe->redirect(JRoute::_('index.php?option=com_ownservice'));
			}
		}

		//add style to document
		$document->addStyleSheet(JURI::base().'/components/com_ownservice/assets/css/style.css');
		$document->addStyleSheet(JURI::base().'/components/com_ownservice/assets/css/nav.css');

		//Get the data from the model
		$row = & $this->get('Item');

		//If has data
		if($row->id)
		{
			$params->set('page_title',	JText::_('OWNSERVICE_EDIT_CONDITION_POINT'));
		}
		else
		{
			$params->set('page_title',	JText::_('OWNSERVICE_NEW_CONDITION_POINT'));
		}

		$document->setTitle( $params->get('page_title') );

		JHTML::_('behavior.formvalidation');

		//assign data to document
		$this->assignRef('row', $row);
		$this->assignRef('params', $params);

		parent::display($tpl);
	}
}